﻿using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using MedicalPCTerminal.Read.API.Appcation.Commands.HospitalCommand;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MedicalPCTerminal.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HospitailController : ControllerBase
    {
        private readonly IMediator mediator;

        public HospitailController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 医院查询
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<object>> HospitalQuery([FromQuery]HospitalQueryCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}
